package com.esun.payment_api.controller;

import com.esun.common.api.CommonPage;
import com.esun.common.api.CommonResult;
import com.esun.common.utils.BlankUtils;
import com.esun.payment_api.domain.SysDictInvContent;
import com.esun.payment_api.service.SysDictInvContentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/sysDictInvContent")
public class SysDictInvContentController {

    @Resource
    SysDictInvContentService sysDictInvContentService;

    /**
     * 查询所有发票-开票内容字典信息，条件查询：税收分类编码、服务名称
     */
    @GetMapping("/querySysDictInvContentAll")
    @ResponseBody
    public CommonResult querySysDictInvContentAll(Short coId, String word,
                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                                  @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        if (BlankUtils.isBlank(coId)) {
            return CommonResult.failed("核算单位id不能为空");
        }
        List<SysDictInvContent> list = sysDictInvContentService.selectByCoId(coId, word, pageSize, pageNum);
        return CommonResult.success(CommonPage.restPage(list));
    }

}
